﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogic.ClassFactory;
using Common;
using ValidateCommon;

namespace RichECMS.ServerPages.Links
{
    public partial class LinkGroupAdd : Util.BasePage.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }



        /// <summary>
        /// 验证输入
        /// </summary>
        private bool ValidateValues()
        {
            bool bolIsValidate = true;
            if (this.txtTitleCN.Value.Trim().Length == 0)
            {
                Alert("请填写栏目中文名称");
                bolIsValidate = false;
            }
            return bolIsValidate;
        }

        /// <summary>
        /// 提交数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitBtnHander(object sender, ImageClickEventArgs e)
        {
            if (!ValidateValues())
            {
                return;
            }
            using (LinksGroupFactory objFactory = new LinksGroupFactory())
            {
                BusinessLogic.BusinessRules.LinksGroup objsLinksInfo= objFactory.NewInstance();
                objsLinksInfo.DataItem.chvGName = this.txtTitleCN.Value;
                objsLinksInfo.DataItem.intIssueState = 0;
                objsLinksInfo.Insert();
            }
            AlertAndRedirectAndExecOther("新增链接组成功！即将跳转，请稍候", "LinkGroupManage.aspx", false, "window.parent.refrashleft();");
        }
    }
}